<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<h1>${message}</h1>
	<sec:authorize access="hasRole('ADMIN')">
	<form:form method="POST" commandName="complaint"  action="/spring/complaint/add">
	<table>
		<tr>
			<td>Title: </td>
			<td> <form:input path="title"/> </td>
			<td> <form:errors path="title" cssclass="error"></form:errors> </td>
			
		</tr>
		<tr>
			<td>Description: </td>
			<td><form:input path="description" /></td>
			<td> <form:errors path="description" cssclass="error"></form:errors> </td>
		</tr>
		<tr>
			<td>Status: </td>
			<td>
					<form:select path="status">
						<form:options items="${status}" itemValue="statusId" itemLabel="statusName" /> 
					</form:select>
			</td>
		</tr>
		<tr>
			<td>User: </td>
			<td>
					<form:select path="user">
						<form:options items="${users}" itemValue="userId" itemLabel="userName" /> 
					</form:select>
			</td>
		</tr>
		<tr>
			<td colspan="2"><button type="submit">Add</button></td>
			<td colspan="2"><button type="reset">Reset</button></td>
		</tr>
	</table>
</form:form>
</sec:authorize>
</body>
</html>